home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
c
/
gedindent.lha
/
sourceindent.ged
< prev
Wrap
Text File
|
1994-07-17
|
1KB
|
46 lines
/* $VER: 1.0, ©1994 Michael Bauer - Indent a C sourcefile */
OPTIONS RESULTS /* enable return codes */
if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
address 'GOLDED.1'
'LOCK CURRENT' /* lock GUI, gain access */
OPTIONS FAILAT 6 /* ignore warnings */
SIGNAL ON SYNTAX /* ensure clean exit */
/* Mark the whole text as one block */
'MARK HIDE' /* Delete existing mark */
'PING 0' /* Store current cursor position */
'GOTO TOP' /* Move to the top of the file */
'MARK SET' /* Set the mark */
'GOTO BOTTOM' /* Move to the bottom of the file */
'MARK SET' /* Set the mark */
/* Name the marked block and save it */
'SAVE BLOCK NAME="dtmp:golded.indent"'
/* Indent the saved code */
SHELL
'indent -br -i4 -sob -sc -npsl -o dtmp:golded.new dtmp:golded.indent'
SHELL
'DELETE BLOCK'
'OPEN NAME="dtmp:golded.new" INSERT'
SHELL
'delete dtmp:golded.#?'
SHELL
'PONG 0'
'UNLOCK' /* VERY important: unlock GUI */
EXIT
SYNTAX:
SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
'UNLOCK'
EXIT